package cn.stylefeng.guns.modular.business.app.controller;

import cn.stylefeng.guns.core.pojo.response.ResponseData;
import cn.stylefeng.guns.modular.business.custom.constant.PublicCommon;
import cn.stylefeng.guns.modular.business.frequency.agreement.entity.Agreement;
import cn.stylefeng.guns.modular.business.frequency.agreement.mapper.AgreementMapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;


/**协议管理
 * @apiNote  协议管理控制器
 * */
@CrossOrigin
@RestController
public class ApiAgreementController {


    @Autowired
    private AgreementMapper agreementMapper;

    /**
     * 协议
     *
     * @return
     */
    @GetMapping("/api/agreement")
    public ResponseData agreement(@RequestParam("code") String code) {
        Agreement agreement = agreementMapper.selectOne(new QueryWrapper<Agreement>().lambda()
                .eq(Agreement::getDelFlag, PublicCommon.启用).eq(Agreement::getCode, code));
        return ResponseData.success(agreement);
    }


}
